<?php

namespace app\admin\controller;
use app\BaseController;
use think\facade\Config;
use think\facade\Cache;

class Admin extends BaseController
{
    public static $status = [
        0 =>'新建',
        1 =>'泰外交部送件',
        2 =>'泰外交部认证',
        3 =>'翻译',
        4 =>'台湾代表处送件',
        5 =>'劳保局送件',
        6 =>'申诉件',
        7 =>'入款',
        8 =>'介绍人佣金',
        9 =>'业务佣金',
        10 =>'结案'
    ];

    //1支出 2是收入
    public static $pay = [
        1 => [
            10 =>'身份证送件费用',
            20 =>'护照送件费用',
            30 =>'身份证认证费用',
            40=>'护照认证费用',
            50=>'身份证台湾代表处费用',
            60=>'护照台湾代表处费用',
            70=>'介绍人佣金',//1000
            80=>'业务绩效奖金'//有客户介绍人 100否则300
        ],
        2=> [
            90 =>'业务所得',//入款金额的20%,
            100 =>'代付回款',//代付费用内定8000
        ]
    ];

    //科目类别
    public static $subject = [
        0 => '送件费',
        1 => '认证费',
        2 => '代付费',
        3 => '佣金',
        4 => '业绩',
        5 => '业务所得',
        6 => '代付回款'
    ];

	//视图全局过滤
	public function display($tpl){
		$this->filterView();
		return $this->view->fetch($tpl);
	}

	public function __call($method, $args)
    {
        return json(['status'=>'01','msg'=>'方法不存在']);
    }

	protected function getTpl($app_id,$extend){
		$applicationInfo = \app\admin\db\Application::getInfo($app_id);
		switch($applicationInfo['app_type']){
			case 1:
				$tpl = $extend;
			break;

			case 2:
				$tpl = 'api_'.$extend;
			break;

			case 3:
				$tpl = 'cms_'.$extend;
			break;
		}

		return $tpl;
	}

}
